
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加检测耗材</title>
    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="${WEB_PATH}/resources/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/bootstrap-table/bootstrap-editable.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">
	<link href="${WEB_PATH}/resources/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
	<link href="${WEB_PATH}/resources/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
	<link href="${WEB_PATH}/resources/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
	
</head>

<style>
.chosen-single.chosen-default.error {
    border: 1px solid #fbc2c4;
    background: rgb(251, 227, 228);
    /* color: #8a1f11; */
}

.chosen-choices.error {
    border: 1px solid #fbc2c4;
    background: rgb(251, 227, 228);
    /* color: #8a1f11; */
}
</style>
<body>
	<div class="col-sm-12">
		<form class="m-t" id="addform">
    		 <div class="row">
    		 	<div class="col-sm-12"> 
                    <div class="form-group">
                        <label>检验机构：</label>
                         <select data-placeholder="选择检验机构" id="JYJGMC" name="JYJGMC"  class="chosen-select form-control" >
                                      <option  value="" hassubinfo="true" ></option>
	                          <#list list as org >
						              <option value="${org.JYJGMC}" hassubinfo="true">${org.JYJGMC}</option>
						      </#list>
						  </select>
                    </div>
                </div>
             </div>
             <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label>耗材名称：</label>
                        <input id="text" name="NAME" id="NAME"   type="text"  class="form-control" placeholder="请输入耗材名称">
                    </div> 
                </div>
             </div>
             <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label>用途：</label>
                        <input id="text" name="YT" id="YT"   type="text"  class="form-control" placeholder="请输入用途">
                    </div> 
                </div>
             </div>
             <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label>型号：</label>
                        <input id="text" name="XH" id="XH"   type="text"  class="form-control" placeholder="请输入型号">
                    </div> 
                </div>
            </div>  
            <div class="row">
	            <div class="col-sm-12">
	                    <div class="form-group">
	                        <label>品牌：</label>
	                        <input type="text" class="form-control" id="PP" name="PP"  placeholder="请输入品牌"/>
	                    </div> 
	                </div>
	            </div> 
            </div>
        </form> 
		</div>
	</div>
    <script src="${WEB_PATH}/resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="${WEB_PATH}/resources/js/ajax.extend.js"></script>
    <script src="${WEB_PATH}/resources/js/bootstrap.min.js?v=3.3.5"></script>
	<script src="${WEB_PATH}/resources/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/wizard/jquery.bootstrap.wizard.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/messages_zh.min.js"></script>
    <script src="${WEB_PATH}/resources/js/plugins/validate/jquery.validate.method.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/layer/layer.js"></script> 
	 <script src="${WEB_PATH}/resources/js/city-picker.data.js"></script>
	<script src="${WEB_PATH}/resources/js/city-picker.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/sweetalert/sweetalert.min.js"></script>
	<script src="${WEB_PATH}/resources/js/plugins/chosen/chosen.jquery.js"></script>
	 <script>
	$(function(){
	    
	 
	    $("#JYJGMC").chosen({width:'100%'}); 
    });
	var e = "<i class='fa fa-times-circle'></i> ";
	var $addformvalidate =  $('#addform').validate({
	      ignore:".ignore",
		  rules: {
		    JYJGMC: {
		      required: true
		    },
		    NAME:{
		      required: true
		    },
		    YT:{
		    	required: true
		    }
		  },
		  errorPlacement: function(error, element) {
            	if(element.get(0).id == "JYJGMC"){
		     		if($("#JYJGID").val()==null||$("#JYJGID").val()==""){
		     			element.next().find("a.chosen-default").addClass("error");
		     		}
            	}
          },
          success:function(element){
             if(element.prop("tagName")=='SELECT'){
		     }
	         
	      }
	});
     //添加检测线信息#addForm
 	function saveAddForm(){
 		if($('#addform').valid()){
 			 var addformJson = $('#addform').serializeJson();
			 $.yilinAjax({
		   	  	type:'POST',
		   	  	loadmsg:'努力提交中......',
		   	  	url:'${WEB_PATH}/reg/consumables/add.do',
		   	  	data:addformJson,
		   	  	btn:null,
        		errorcallback:null,
        		successcallback:success
		   	 });
    	}
 	}
 	
 	function success(result){
 		if(result.success == true){
	    	layer.alert('<font color="#1ab394">'+result.msg+'</font>', {
			  	skin: 'layui-layer-molv',
			  	icon: 1,
			  	closeBtn: 0
			},function(){
				parent.$("#exampleTableEvents").bootstrapTable('refresh');
				var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				parent.layer.close(index); 
			});
		}else{
			$('#saveBut').attr("disabled",false); 
		 	$('#subBut').attr("disabled",false);       
	    	layer.alert('<font color="red">'+result.msg+'</font>', {
			  skin: 'layui-layer-molv' ,
			  closeBtn: 0,
			  icon: 5,
			});
		}
 	}
  </script>
</body>
</html>